package com.yawn.zdweb.defect;

import com.yawn.zdweb.controller.entity.RestResponse;
import com.yawn.zdweb.entity.Defect;
import feign.Headers;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "zd-defect", fallback = DefectServiceImpl.class)
public interface DefectService {

    @Headers({"Content-Type: application/json","Accept: application/json"})
    @PostMapping("/defect/start")
    RestResponse startDefect(@RequestBody Defect defect, @RequestParam("userId") String userId);

    @GetMapping("/task/todo")
    RestResponse todoTask(@RequestParam("userId") String userId);

    @PostMapping("/set/assignee")
    RestResponse setAssignee(@RequestBody Defect defect, @RequestParam("userId") String userId);

    @PostMapping("/do/task")
    RestResponse doTask(@RequestBody Defect defect, @RequestParam("userId") String userId);

    @PostMapping("/defect/revise")
    RestResponse reviseDefect(@RequestBody Defect defect, @RequestParam("userId") String userId);

    @PostMapping("/comment/add")
    RestResponse addComment(@RequestParam("taskId") String taskId, @RequestParam("comment") String comment, @RequestParam("userId") String userId);

    @GetMapping("/comment/list")
    RestResponse getProcessInstanceComment(@RequestParam("taskId") String taskId);

    @PostMapping("/attachment/add")
    void addAttachment(@RequestParam("taskId") String taskId, @RequestParam("attachName") String attachName, @RequestParam("userId") String userId);
}
